﻿namespace EasyToolkit.BindingTemplates.Definitions.Binding
{
    using EasyToolkit.BindingTemplates.Context;
    using EasyToolkit.BindingTemplates.Definitions.Binding;

    class BindingDefinitionConstante : BindingDefinition
    {
        public string Value
        { get; private set; }

        override public object UpdateDataSource(object dataSource, object data)
        {
            return Value;
        }

        override public object ResolveBinding(object dataSource)
        {
            return Value;
        }

        static public BindingDefinitionConstante CreateInstance(string value)
        {
            BindingDefinitionDescription definitionDescription = new BindingDefinitionDescription() { IsReadOnly = true };
            return new BindingDefinitionConstante() { DefinitionDescription = definitionDescription,
                                                      Value = value, IsBoundWithData = false };
        }
    }
}
